 /**
   * Copyright 2014 Viettel Telecom. All rights reserved.
   * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
 package com.viettel.core.bussiness.cms; 
import java.util.List; 

import org.springframework.beans.factory.annotation.Autowired; 

import com.viettel.core.exceptions.BusinessException; 
import com.viettel.core.exceptions.DataAccessException; 
import com.viettel.core.dao.cms.ArticleCategoryDAO;
import com.viettel.core.entities.cms.ArticleCategory;
import com.viettel.core.entities.vo.ArticleCategorySearchFilter;
import com.viettel.core.entities.vo.ArticleCategorySearchVO;
import com.viettel.core.entities.vo.ArticleCategoryVO;
 /**
   *  Mo ta muc dich cua lop (interface)
   *  @author: TOANTM1
   *  @version:  
   *  @since: 27/02/2014 - 10:50:59
   */
 public class ArticleCategoryMgrImpl implements ArticleCategoryMgr{ 
	@Autowired 
	ArticleCategoryDAO articleCategoryDAO; 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public ArticleCategory getArticleCategoryById(Integer id) throws BusinessException { 
		try { 
			return  articleCategoryDAO.getArticleCategoryById(id); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public ArticleCategory createArticleCategory(ArticleCategory articleCategory) throws BusinessException { 
		try { 
			return articleCategoryDAO.createArticleCategory(articleCategory); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void updateArticleCategory(ArticleCategory articleCategory) throws BusinessException { 
		try { 
			articleCategoryDAO.updateArticleCategory(articleCategory); 
		} catch (DataAccessException e) {	 
			throw new BusinessException(e); 
		} 
	} 
 
 	/**@author TOANTM1
  	 * 27/02/2014 - 10:50:59
  	 * For: 
  	 * @description: 
  	 */
 	@Override 
	public void deleteArticleCategory(ArticleCategory articleCategory) throws BusinessException { 
		try { 
			articleCategoryDAO.deleteArticleCategory(articleCategory); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleCategory> getAllArticleCategory() throws BusinessException {
		try { 
			return articleCategoryDAO.getAllArticleCategory(); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleCategory> getListArticleCategoryByParentId(Integer parentId)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListArticleCategoryByParentId(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleCategory> getListParentArticleCategory(Integer parentId)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListParentArticleCategory(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	
	@Override
	public List<ArticleCategorySearchVO> getListParentByArticleCategory(Integer parentId)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListParentByArticleCategory(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	
	@Override
	public List<ArticleCategorySearchVO> getListNotParentByArticleCategory(Integer parentId)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListNotParentByArticleCategory(parentId); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	} 
	
	/**
 	 * @author tuantm20
 	 * @throws DataAccessException
 	 */
	@Override
	public List<ArticleCategorySearchVO> getListArticleCategoryByFilter(ArticleCategorySearchFilter filter)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListArticleCategoryByFilter(filter); 
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleCategory> getArticleCategoryNotParent()
			throws BusinessException {
		try { 
			return articleCategoryDAO.getArticleCategoryNotParent();
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}

	@Override
	public List<ArticleCategoryVO> getListArticleCategory(int categoryId)
			throws BusinessException {
		try { 
			return articleCategoryDAO.getListArticleCategory(categoryId);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
	@Override
	public Boolean checkNameExist(String userName) throws BusinessException{
		try { 
			return articleCategoryDAO.checkNameExist(userName);
		} catch (DataAccessException e) { 
			throw new BusinessException(e); 
		} 
	}
} 
